import { Redirect, connect } from 'umi'

const Auth = (props) => {
    const { global: { user } } = props;
    const { isLogin } = user
    if (isLogin) {
        return <div>{props.children}</div>;
    } else {
        return <Redirect to="/login" />;
    }
}

export default connect(({ global }) => ({
    global,
}))(Auth);